package com.kuzan.autocloud.common.model.menu;

import com.kuzan.autocloud.common.model.Base;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * <p>Description: 菜单根节点，没有权限</p>
 *
 * @author kuzank 2019/12/2
 */
@Data
@NoArgsConstructor
@Entity
@Table(name = "sys_menu_root")
public class MenuRoot extends Base {


    /**
     * 菜单类型
     */
    public enum MenuType {
        pid("menuType"),

        App("mt_app"),
        Dashboard("mt_dashboard"),
        Url("mt_url");

        private String name;

        MenuType(String name) {
            this.name = name;
        }

        public String value() {
            return name;
        }

        public String getName() {
            return name;
        }
    }


    /**
     * 菜单权限范围
     */
    public enum MenuPermissionScope {
        pid("menuPermissionScope"),

        workspace("mps_workspace"),
        specify("mps_specify");

        private String name;

        MenuPermissionScope(String name) {
            this.name = name;
        }

        public String value() {
            return name;
        }

        public String getName() {
            return name;
        }
    }


    public static MenuRoot of(String title, String id) {
        MenuRoot obj = new MenuRoot();
        obj.setId(id);
        obj.setTitle(title);
        obj.setSort(getSortIncrement());
        return obj;
    }
}
